import request from '~/utils/request'

// 查看当前可用优惠券
export function queryCoupon(uid, totalPrice) {
  return request({
    url: '/pro/coupon/queryQualifiedCoupon',
    method: 'post',
    data: {
      userId: uid + '',
      totalPrice: totalPrice + ''
    }
  })
}

// 查询当前可用促销
export function queryPromotion(idList) {
  return request({
    url: '/pro/promotion/queryQualifiedPromotions',
    method: 'post',
    data: {
      ids: idList,
      promotionId: '1'
    }
  })
}

// 使用促销
export function usePromotion(type, price, ids) {
  return request({
    url: '/pro/promotion/usePromotion',
    method: 'post',
    data: {
      type,
      price,
      ids,
      promotionId: '1'
    }
  })
}
